package com.dilean.impl.model;

import com.dilean.api.model.AbstractEntity;

public abstract class AbstractEntityImpl implements AbstractEntity
{
    // TODO try to add common fields ID and NAME here, but I'm not sure it is possible 
    
    @Override
    public int hashCode()
    {
        return getId();
    }
    
    @Override
    public boolean equals(Object o)
    {
        if (o == null || !(o instanceof AbstractEntity))
            return false;
        
        return getId().equals(((AbstractEntity) o).getId());
    }
    
    @Override
    public String toString()
    {
        return this.getClass().getSimpleName() + "[" + getId() + "#" + getName() + "]";
    }
    
}
